[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Val                      Converts a String to a Number

 Val(Source : <string>; var Num : Real;    var Err : Integer);           [TP]
 Val(Source : <string>; var Num : Integer; var Err : Integer);           [TP]

    Converts Source into a real or integer value (depending upon Num's
    type). If no error occurs, Err is 0; otherwise, Err contains the
    character position of the character in Source that caused the error.

          Source    Any string value (constant, variable, function call or
                    expression).

             Num    An integer or real variable.

             Err    An integer variable.

  -------------------------------- Example ---------------------------------

           Name := '421';
           Val(Name,I,Err);         { I = 421, Err = 0 }

           Name := '3.1416';
           Val(Name,X,Err);         { X = 3.1416, Err = 0 }

           Name := '53d';
           Val(Name,I,Err);         { I = 53, Err = 3 }

See Also: Str
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson